import request from "../utils/request"

/**
 * 扫描二维码
 */
export const scanQrcodeApi = (qrToken) => {
	return request({
		method: 'GET',
        data: {
            qrToken
        },
		url:'/portal/company/scanCode'
	})
}

/**
 * 确认登录
 */
export const confirmLoginApi = (data) => {
    return request({ 
        method: 'POST',
        data,
        url: '/portal/company/confirmLogin'
    })
}

/**
 * 根据公司全称查询公司信息
 */
export const getCompanyInfoApi = (fullName) => {
    return request({
        method: 'GET',
        data: {
            fullName
        },
        url: '/portal/company/get_by_full_name'
    })
}



/**
 * 获取创建公司文件上传的签名
 */
export const getApplyUploadSignApi = () => {
    return request({
        method: 'GET',
        url: '/portal/company/get_apply_upload_sign'
    })
}

/**
 * 提交公司审核申请
 */
export const submitCompanyApplyApi = (data) => {
    return request({
        method: 'POST',
        data,
        url: '/portal/company/apply'
    })
}

/**
 * 获取一级行业列表
 */
export const getIndustryTopListApi = () => {
    return request({
        method: 'GET',
        url: '/portal/recourse/get_industry_top_list'
    })
}

/**
 * 获取二级行业列表
 * @param {string} id - 一级行业ID
 */
export const getChildrenIndustryApi = (id) => {
	console.log("id",id);
	
    return request({
        method: 'GET',
        data: { id },
        url: '/portal/recourse/get_children_industry'
    })
}

/**
 * 获取企业人员规模数据
 */
export const getStaffSizeDataApi = () => {
	return request({
		method: 'GET',
		data: { typeKey: 'staff_size' },
		url: '/portal/recourse/get_dictionary_datas_typekey'
	})
}

/**
 * 根据公司ID获取公司详情
 */
export const getCompanyDetailApi = (companyId) => {
	return request({
		method: 'GET',
		data: { companyId },
		url: '/portal/company/simple/info'
	})
}

/**
 * 获取用户绑定的公司详情
 */
export const getMyBindCompanyDetailApi = () => {
	return request({
		method: 'GET',
		url: '/portal/user/my_bind_company/detail'
	})
}

/**
 * 根据公司ID获取公司详细信息（供求职者查看）
 * @param {string} companyId - 公司ID
 */
export const getCompanyDetailByIdApi = (companyId) => {
	return request({
		method: 'GET',
		url: `/portal/company/detail?companyId=${companyId}`
	})
}

/**
 * 修改企业信息
 * @param {Object} data - 企业信息数据
 */
export const modifyCompanyInfoApi = (data) => {
	return request({
		method: 'PUT',
		url: '/portal/company/info/modify',
		data: data
	})
}

/**
 * 获取用户绑定的企业简单信息
 */
export const getMyBindCompanySimpleApi = () => {
	return request({
		method: 'GET',
		url: '/portal/user/my_bind_company/simple'
	})
}

/**
 * HR搜索简历
 */
export const searchResumeApi = (data) => {
	return request({
		method: 'POST',
		url: '/portal/resume/hr_search',
		data: data
	})
}



/**
 * 获取企业公司性质数据
 */
export const getCompanyNatureDataApi = () => {
	return request({
		method: 'GET',
		data: { typeKey: 'company_nature' },
		url: '/portal/recourse/get_dictionary_datas_typekey'
	})
}


export const getFinancingStatusApi = () => {
	return request({
		method: 'GET',
		data: { typeKey: 'financing_status' },
		url: '/portal/recourse/get_dictionary_datas_typekey'
	})
}

/**
 * 根据多个字典数据类型获取字典数据
 * @param {Array<string>} typeKeys - 字典数据类型键数组
 */
export const getDictionaryDataListByTypesApi = (typeKeys) => {
    console.log("请求的字典类型",typeKeys);
    
	return request({
		method: 'post',
		url: '/portal/recourse/get_dictionary_datas_typekeys',
		data: {"typeKeys":typeKeys}
	})
}



export const getCompanyPhotoUploadSignsApi = (count) => {
	return request({
		method: 'GET',
		url: '/portal/company/get_company_photo_upload_signs',
		data: {
			count
		}
	})
}

/**
 * 更新公司相册
 * @param {Object} data - 包含companyId和photos的数据
 */
export const updateCompanyPhotosApi = (data) => {
	return request({
		method: 'POST',
		url: '/portal/company/update_company_photos',
		data: data
	})
}

/**
 * 根据typeKey和dataKey获取字典数据详情
 * @param {Array} dictKeys - 包含typeKey和dataKey的对象数组
 */
export const getDictDataKeysListByTypeKeyAndDataKeyApi = (dictKeys) => {
	return request({
		method: 'POST',
		url: '/portal/recourse/get_dict_dataKey_typeKey',
		data: dictKeys
	})
}